package com.cetc.nsfx.controller;

import java.util.HashMap;
import java.util.Map;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cetc.nsfx.security.vo.UserContext;
import com.cetc.nsfx.service.HomeService;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2016/1/6 0006.
 */
@Controller
@RequestMapping("/home")
public class HomeController {
	
	@Autowired
	private HomeService homeService;
	
    @RequestMapping("/main")
    public String main(){
        return "main";
    }

    @RequestMapping("/warningMain")
    public String warningMain(HttpServletRequest req){
        req.getSession().setAttribute("current_menu", "4000"); 
        return "warning_main";
    }
    
    /**
	 * 获得12366数据
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getPhoneData", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> getPhoneData(HttpServletRequest request) {
		
		
		Map<String,Object> phoneData = new HashMap<String,Object>();
		
		phoneData.put("msg", homeService.getPhoneData());
		
		return phoneData;	
	} 
	
	  /**
		 * 获得实体办税厅数据
		 * @param request
		 * @return
		 */
		@RequestMapping(value = "/getTaxOfficeEntityData", method = RequestMethod.GET)
		@ResponseBody
		public Map<String, Object> getTaxOfficeEntityData(HttpServletRequest request) {
			
			
			Map<String,Object> phoneData = new HashMap<String,Object>();
			
			phoneData.put("msg", homeService.getTaxOfficeEntityData());
			
			return phoneData;	
		} 
	
		/** 获得网上在线营业厅
		 * @param request
		 * @return
		 */
		@RequestMapping(value = "/getTaxOfficeOnlineData", method = RequestMethod.GET)
		@ResponseBody
		public Map<String, Object> getTaxOfficeOnlineData(HttpServletRequest request) {
			
			
			Map<String,Object> phoneData = new HashMap<String,Object>();
			
			phoneData.put("msg", homeService.getTaxOfficeOnlineData());
			
			return phoneData;	
		} 
	
	
	
	
    
    
}
